<?php
/**
 * Created by IntelliJ IDEA.
 * User: wanglu
 * Date: 2017/7/19
 * Time: 14:13
 */
/**
 * Created by wanglu on 2017/7/19.
 */
class Admin extends AdminBase {

    function __construct() {
        parent::__construct();
    }

    public function index() {
        $this->showView("index");
    }

    public function home() {
        $this->showView("home");
    }

    public function release_app() {

        $op = $this->input->get('op');

        if (empty($op)) {
            $this->showView("app_release");
        } else {
            $this->load->model('app_model');
            $search = $this->input->post("search");
            $order = $this->input->post("order");
            $order_by_createtime =  $order[0]["dir"];

            $searchValue = $search['value'];
            $start = $this->input->post("start");
            $length = $this->input->post("length");
            $data = $this ->app_model->get_release_apps($start, $length, $searchValue, $order_by_createtime);
            foreach ($data['data'] as $key => $value) {
                $data['data'][$key]["createtime"] = date("Y-m-d  h:i:s", $data['data'][$key]["createtime"]);
            }
            echo json_encode($data);
            
        }
    }
}